perm filename WORDCO.LSP[E83,JMC] blob sn#727147 filedate 1983-10-07 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	wordco.lsp[e83,jmc]	LISP word counter
C00004 ENDMK
CāŠ—;
;;;wordco.lsp[e83,jmc]	LISP word counter

;;; The file has the form (<name> <extension>)

(defun wordcount (file)
       (do ((fileob (open file))
	    (count 0 (add1 count))
	    (line 'foo (readline fileob)))
	   ((null line) (close fileob) count)
	   (do ((i 1 (add1 i))
		(z 'foo (getchar line i)))
	       ((null z))
	       (if (and (eq z '| |) (not (eq '| | (getchar line (add1 i)))))
		   (setq count (add1 count))))))

(setq base (setq ibase 12))
(wordcount '(presid 1))